﻿using System.Net.Sockets;

namespace GameLogic
{
    public class TCPClientHandle : ClientHandle
    {
        Socket m_Socket;
        byte[] m_Data = new byte[1024];

        public byte[] Data { get => m_Data; }
        public Socket Socket { get => m_Socket; }

        TCPClientHandle() { }
        public static TCPClientHandle Create(Socket socket)
        {
            TCPClientHandle handle = new TCPClientHandle();
            handle.m_Socket = socket;
            return handle;
        }
        public override void Send(byte[] data, int length)
        {
            m_Socket.Send(data, length, SocketFlags.None);
        }
        public override void Close()
        {
            m_Socket.Close();
        }
    }
}
